﻿using System;
using Validate.Net;

namespace Test
{
    public class UserModel
    {
        /// <summary>
        /// 校验必填，如果添加特性[Describe]，则校验该属性不合法时
        /// 错误提示信息则是：属性：密码，值：xxxx， 不正确，而不是属性：Password，值：xxxx 不正确
        /// </summary>
        [ValidateRequired]
        [Describe("密码")]
        public string Password { get; set; }

        /// <summary>
        /// 校验字符串长度区间
        /// </summary>
        [ValidateRangeLength(6, 20)]
        [Describe("用户账户")]
        public string Account { get; set; }

        /// <summary>
        /// 校验字母，只能包含字母
        /// </summary>
        [ValidateLetter]
        public string Letter { get; set; }

        /// <summary>
        /// 校验最大值
        /// </summary>
        [ValidateMaxValue(20)]
        public int Age { get; set; }

        /// <summary>
        /// 校验最小值
        /// </summary>
        [ValidateMinValue(5)]
        public int MinLong { get; set; }

        /// <summary>
        /// 校验值区间
        /// </summary>
        [ValidateRangeValue(10,20)]
        public int AgeRange { get; set; }

        /// <summary>
        /// 校验最大长度
        /// </summary>
        [ValidateMaxLength(20)]
        public string MaxLength { get; set; }

        /// <summary>
        /// 校验最小长度
        /// </summary>
        [ValidateMinLength(5)]
        public string MinLength { get; set; }

        /// <summary>
        /// 校验Email
        /// </summary>
        [ValidateEmail]
        public string Email { get; set; }

        /// <summary>
        /// 校验邮编
        /// </summary>
        [ValidateZipCode]
        public string ZipCode { get; set; }

        /// <summary>
        /// 校验包含中文
        /// </summary>
        [ValidateChinese]
        public string Chinese { get; set; }

        /// <summary>
        /// 校验负整数
        /// </summary>
        [ValidateNegtiveInt]
        public int NegtiveInt { get; set; }

        /// <summary>
        /// 校验正整数
        /// </summary>
        [ValidatePositiveInt]
        public int PositiveInt { get; set; }

        /// <summary>
        /// 校验非负整数
        /// </summary>
        [ValidateNonnegativeInt]
        public double NonnegativeInt { get; set; }

        /// <summary>
        /// 校验非正整数
        /// </summary>
        [ValidateNonpositiveInt]
        public double NonpositiveInt { get; set; }

        /// <summary>
        /// 校验ip地址
        /// </summary>
        [ValidateIp]
        public string Ip { get; set; }

        /// <summary>
        /// 校验url
        /// </summary>
        [ValidateUrl]
        public string url { get; set; }

        /// <summary>
        /// 校验qq号
        /// </summary>
        [ValidateQQ]
        public string QQ { get; set; }

        /// <summary>
        /// 自定义正则校验，特性[ValidateRegular]为自定义正则表达式校验
        /// 第一个参数为您的正则表达式，第二个参数为自定义校验不合法时的提示信息
        /// </summary>
        [ValidateRegular("^[0-9]{6}$", "邮编格式校验失败(自定义)")]
        public string CustomStr { get; set; }

        /// <summary>
        /// 校验身份证（15位身份证号，和18位身份证号）
        /// </summary>
        [ValidateIDCard]
        public string IDCard { get; set; }

        /// <summary>
        /// 校验统一社会信用代码
        /// </summary>
        [ValidateSocialCreditCode]
        public string SocialCreditCode { get; set; }

        /// <summary>
        /// 一般密码校验（包含数字和字母及常规特殊符号）
        /// </summary>
        [ValidatePwd]
        public string Pwd { get; set; }

    }
}
